//
//  Double.swift
//  UsingCarModule_Demo
//
//  Created by HeHeAdmin on 2019/10/8.
//  Copyright © 2019 HeHeAdmin. All rights reserved.
//

import Foundation
import UIKit

extension Double {
    
    
    /// 保留小数点
    /// - Parameter places: 保留几位
     public  func roundTo(places:Int) -> Double {
           let divisor = pow(10.0, Double(places))
           return (self * divisor).rounded() / divisor
     }
}
